﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;

namespace Isotop.Text
{
	/// <summary>
	/// This interface implements a base for virtual string handling, i.e. 
	/// support of virtual method calls for classes and the possibility of 
	/// wrapping one's own string handling in classes
	/// </summary>
	public interface IString : IComparable, IComparable<IString>, IEquatable<IString>
	{
		bool Contains(IString value);
		bool EndsWith(IString value, StringComparison comparisonType);
		int IndexOf(IString value, int startIndex, int count, StringComparison comparisonType);
		int IndexOfAny(char[] anyOf, int startIndex, int count);
		IString Insert(int startIndex, IString value);
		//bool IsNormalized(NormalizationForm form);
		int LastIndexOf(IString value, int startIndex, int count, StringComparison comparisonType);
		int LastIndexOfAny(char[] anyOf, int startIndex, int count);
		int Length { get; }
		//void Normalize(NormalizationForm form);
		int PadLeft(int totalWidth, char paddingChar);
		int PadRight(int totalWidth, char paddingChar);
		IString Remove(int startIndex, int count);
		IString Replace(IString oldValue, IString newValue);
		IEnumerable<IString> Split(IEnumerable<IString> separators, int count, StringSplitOptions options);
		bool StartsWith(IString value, StringComparison comparisonType);
		IString Substring(int startIndex, int length);
		IString ToLower(CultureInfo culture);
		IString ToUpper(CultureInfo culture);
		IString Trim(params char[] trimChars);
		IString TrimEnd(params char[] trimChars);
		IString TrimStart(params char[] trimChars);
	}

	public static class IStringExtensions
	{
		public static bool EndsWith(this IString @this, IString value)
		{
			return @this.EndsWith(value, StringComparison.CurrentCulture);
		}

		//IndexOf 8
		//IndexOfAny 2
	}

	public class testc : IString
	{
		public int CompareTo(object obj)
		{
			throw new NotImplementedException();
		}

		public int CompareTo(string other)
		{
			throw new NotImplementedException();
		}

		public int CompareTo(IString other)
		{
			throw new NotImplementedException();
		}

		public bool Equals(string other)
		{
			throw new NotImplementedException();
		}

		public bool Equals(IString other)
		{
			throw new NotImplementedException();
		}

		public bool Contains(string value)
		{
			throw new NotImplementedException();
		}

		public bool EndsWith(string value, StringComparison comparisonType)
		{
			throw new NotImplementedException();
		}

		public bool Contains(IString value)
		{
			throw new NotImplementedException();
		}

		public bool EndsWith(IString value, StringComparison comparisonType)
		{
			throw new NotImplementedException();
		}

		public int IndexOf(IString value, int startIndex, int count, StringComparison comparisonType)
		{
			throw new NotImplementedException();
		}

		public int IndexOfAny(char[] anyOf, int startIndex, int count)
		{
			throw new NotImplementedException();
		}

		public IString Insert(int startIndex, IString value)
		{
			throw new NotImplementedException();
		}

		public int LastIndexOf(IString value, int startIndex, int count, StringComparison comparisonType)
		{
			throw new NotImplementedException();
		}

		public int LastIndexOfAny(char[] anyOf, int startIndex, int count)
		{
			throw new NotImplementedException();
		}

		public int Length { get { throw new NotImplementedException(); } }

		public int PadLeft(int totalWidth, char paddingChar)
		{
			throw new NotImplementedException();
		}

		public int PadRight(int totalWidth, char paddingChar)
		{
			throw new NotImplementedException();
		}

		public IString Remove(int startIndex, int count)
		{
			throw new NotImplementedException();
		}

		public IString Replace(IString oldValue, IString newValue)
		{
			throw new NotImplementedException();
		}

		public IEnumerable<IString> Split(IEnumerable<IString> separators, int count, StringSplitOptions options)
		{
			throw new NotImplementedException();
		}

		public bool StartsWith(IString value, StringComparison comparisonType)
		{
			throw new NotImplementedException();
		}

		public IString Substring(int startIndex, int length)
		{
			throw new NotImplementedException();
		}

		public IString ToLower(CultureInfo culture)
		{
			throw new NotImplementedException();
		}

		public IString ToUpper(CultureInfo culture)
		{
			throw new NotImplementedException();
		}

		public IString Trim(params char[] trimChars)
		{
			throw new NotImplementedException();
		}

		public IString TrimEnd(params char[] trimChars)
		{
			throw new NotImplementedException();
		}

		public IString TrimStart(params char[] trimChars)
		{
			throw new NotImplementedException();
		}
	}
}
